var minSubsequence = function (nums) {
  let sum = 0, n = nums.length, cur = 0, ans = []
  nums.sort((a, b) => a - b)
  for (let i = 0; i < n; i++) {
    sum += nums[i]
  }
  for (let i = 0; i < n; i++) {
    while (cur <= sum) {
      sum -= nums[n - 1]
      cur += nums[n - 1]
      ans.push(nums[--n])
    }
  }
  console.log(ans);
  return ans
};

let nums = [4, 3, 10, 9, 8]
minSubsequence(nums)